package com.cyw.baselibrary.imageloader;


/**
 * 图片加载工具类
 * Created by ChenYuanWang on 2017.7.25.
 */
public class ImageLoaderUtil {

    private BaseImageLoaderStrategy strategy;


    private ImageLoaderUtil() {
        strategy = new GlideImageLoaderStrategy();
    }

    private static ImageLoaderUtil instance;

    public static ImageLoaderUtil getInstance() {
        if (instance == null) {
            synchronized (ImageLoaderUtil.class) {
                if (instance == null) {
                    instance = new ImageLoaderUtil();
                    return instance;
                }
            }
        }
        return instance;
    }


    public void loadImage(ImageLoadBuilder builder) {
        strategy.loadImage(builder);
    }

    public void loadNormal(ImageLoadBuilder builder) {
        strategy.loadNormal(builder);
    }

    public void loadRound(ImageLoadBuilder builder) {
        strategy.loadRound(builder);
    }

    public void loadCorners(ImageLoadBuilder builder) {
        strategy.loadCorners(builder);
    }


    public void setLoadImgStrategy(BaseImageLoaderStrategy strategy) {
        this.strategy = strategy;
    }


}
